<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/home', function () {
    return view('welcome');
});


Route::auth();

Route::get('/', 'HomeController@index');
Route::get('/show', 'HomeController@show');

//Route::get('/show',[
//    'middleware'=>'auth',
//    'uses'=>'ExampleController@show'
//]);

/*Route::get('profile', function () {
    return 'hello world';
});*/



Route::get('foo',['middleware'=>'demo',function(){
    return 'this page may only be viewed by manage';
}]);



Route::group(['prefix' => 'resource', 'namespace' => 'Resource','middleware' =>'auth'], function()
{
    //资源类控制器
    Route::get('/', 'ResourceController@index');
    Route::get('/create', 'ResourceController@create');
    Route::post('/store','ResourceController@store');
    Route::get('/edit/{id}', 'ResourceController@edit');
    Route::get('/destroy/{id}', 'ResourceController@destroy');
    Route::post('/update/{id}','ResourceController@update');

    //邀约分配展示
    Route::get('/yy_assign/{type}','ResourceController@yy_assign');
    //主管确定分配
    Route::post('/yy_assign_do','ResourceController@yy_assign_do');
    //电话邀约
    Route::get('/yy_invite/{type}','ResourceController@yy_invite');

    //门市分配展示
    Route::get('/ms_assign/{type}','ResourceController@ms_assign');
    //主管确定分配
    Route::post('/ms_assign_do','ResourceController@ms_assign_do');
    //门市接待
    Route::get('/ms_reception/{type}','ResourceController@ms_reception');
});

Route::group(['prefix' => 'resource/remark', 'namespace' => 'Resource','middleware' =>'auth'], function()
{
    //资源记录控制器
    Route::get('/{id}', 'RemarkController@index');
//    Route::get('/create/{id}', 'RemarkController@create');
//    Route::post('/store/{id}','RemarkController@store');
    Route::get('/edit/{rid}', 'RemarkController@edit');
    Route::post('/update/{rid}','RemarkController@update');
    Route::get('/destroy/{rid}', 'RemarkController@destroy');
    //电话邀约结果展示
    Route::get('/invite/{id}','RemarkController@invite');
    //电话邀约结果储存
    Route::post('/invite/{id}','RemarkController@invite_save');

    //门市接待列表展示
    Route::get('/reception/{id}','RemarkController@reception');
    //门市接待结果储存
    Route::post('/reception/{id}','RemarkController@reception_save');

    //动态生成菜单
    Route::post('/createMenu','RemarkController@createSubMenu');
});

Route::resource('process','SystemConf\ProcessController');


//测试用控制器
Route::resource('example','ExampleController');

Route::post('example','ExampleController@ajaxExamp');

